package com.yx.shop.entitly;


import java.math.BigDecimal;

public class Cart {

  private int cid;
  private int uid;
  private int pid;
  //商品小计
  private BigDecimal ccount;
  //商品数量
  private int cnum = 0;

  private Product product;

  @Override
  public String toString() {
    return "Cart{" +
            "cid=" + cid +
            ", uid=" + uid +
            ", pid=" + pid +
            ", ccount=" + ccount +
            ", cnum=" + cnum +
            ", product=" + product +
            '}';
  }

  public Cart(int uid, int pid, BigDecimal ccount, int cnum) {
    this.uid = uid;
    this.pid = pid;
    this.ccount = ccount;
    this.cnum = cnum;
  }

  public Cart(int cid, int uid, int pid, BigDecimal ccount, int cnum, Product product) {
    this.cid = cid;
    this.uid = uid;
    this.pid = pid;
    this.ccount = ccount;
    this.cnum = cnum;
    this.product = product;
  }

  public Cart(int uid, int pid, BigDecimal ccount, int cnum, Product product) {
    this.uid = uid;
    this.pid = pid;
    this.ccount = ccount;
    this.cnum = cnum;
    this.product = product;
  }

  public Cart() {
  }

  public Product getProduct() {
    return product;
  }

  public void setProduct(Product product) {
    this.product = product;
  }

  public int getCid() {
    return cid;
  }

  public void setCid(int cid) {
    this.cid = cid;
  }


  public int getUid() {
    return uid;
  }

  public void setUid(int uid) {
    this.uid = uid;
  }


  public int getPid() {
    return pid;
  }

  public void setPid(int pid) {
    this.pid = pid;
  }


  public BigDecimal getCcount() {
    BigDecimal pprice = BigDecimal.valueOf(product.getPprice());
    BigDecimal bigDecimal = new BigDecimal(cnum);
    return pprice.multiply(bigDecimal);
  }

  public void setCcount(BigDecimal ccount) {
    this.ccount = ccount;
  }


  public int getCnum() {
    return cnum;
  }

  public void setCnum(int cnum) {
    this.cnum = cnum;
  }

}
